API Documentation
ListBox.h
1 // ListBox.h
3 //
5 
6 namespace nkWinUi
7 {
11  class DLL_WINUI_EXPORT ListBox : public Component
12  {
13  public :
14 
18  class DLL_WINUI_EXPORT Item
19  {
20  public :
21 
25  Item () ;
29  ~Item () ;
30 
31  // Getters
35  ListBox* getParentList () const ;
43  void* getAttachedData () const ;
44 
45  // Setters
51  void setParentList (ListBox* parent) ;
57  void setLabel (const nkMemory::StringView& label) ;
65  void setAttachedData (void* data) ;
66  } ;
67 
68  public :
69 
75  ListBox () ;
79  ~ListBox () ;
80 
81  // Getters
86  Item* getItemFromLabel (const nkMemory::StringView& label) const ;
91  Item* getItemFromData (void* data) const ;
96  Item* getItemFromIndex (unsigned int index) const ;
100  virtual Item* getCurrentSelection () const ;
104  virtual int getCurrentSelectionIndex () const ;
112  unsigned int getItemCount () const ;
113 
114  // Setters
121 
131  virtual Item* insertItem (const nkMemory::StringView& text, void* data) ;
137  virtual void* deleteItem (const nkMemory::StringView& name) ;
144  virtual void changeItemLabel (const nkMemory::StringView& oldText, const nkMemory::StringView& newText) ;
153  void changeItemData (const nkMemory::StringView& text, void* newData) ;
160  virtual bool setSelected (const nkMemory::StringView& text) ;
167  virtual bool setSelectedIndex (unsigned int index) ;
174  bool setSelectedData (void* data) ;
178  virtual void clearItems () ;
179 
183  virtual void exportIntrospection (nkExport::Node* rootNode) override ;
187  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
188  } ;
189 }
nkWinUi::ListBox::Item::~Item
~Item()
nkWinUi::ListBox::Item::setAttachedData
void setAttachedData(void *data)
nkWinUi::ListBox::ListBox
ListBox()
nkWinUi::ListBox::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemCount
unsigned int getItemCount() const
nkWinUi::ListBox::getCurrentSelection
virtual Item * getCurrentSelection() const
nkWinUi::ListBox::setSelectionSpecializedCallback
void setSelectionSpecializedCallback(listBoxSelectionCallback value)
nkWinUi::ListBox
A graphical list box.
Definition: ListBox.h:12
nkWinUi::ListBox::getItemFromIndex
Item * getItemFromIndex(unsigned int index) const
nkWinUi::ListBox::deleteItem
virtual void * deleteItem(const nkMemory::StringView &name)
nkWinUi::ListBox::Item::Item
Item()
nkWinUi::ListBox::setSelectedIndex
virtual bool setSelectedIndex(unsigned int index)
nkWinUi::ListBox::getSelectionSpecializedCallback
listBoxSelectionCallback getSelectionSpecializedCallback() const
nkWinUi::ListBox::setSelectedData
bool setSelectedData(void *data)
nkWinUi::ListBox::Item
Definition: ListBox.h:19
nkWinUi::ListBox::exportIntrospection
virtual void exportIntrospection(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemFromLabel
Item * getItemFromLabel(const nkMemory::StringView &label) const
nkWinUi::ListBox::changeItemLabel
virtual void changeItemLabel(const nkMemory::StringView &oldText, const nkMemory::StringView &newText)
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::ListBox::setSelected
virtual bool setSelected(const nkMemory::StringView &text)
nkWinUi::ListBox::Item::getParentList
ListBox * getParentList() const
nkWinUi::ListBox::Item::setLabel
void setLabel(const nkMemory::StringView &label)
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkWinUi::ListBox::insertItem
virtual Item * insertItem(const nkMemory::StringView &text, void *data)
nkWinUi::ListBox::~ListBox
~ListBox()
nkWinUi::ListBox::Item::getLabel
nkMemory::StringView getLabel() const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkWinUi::ListBox::clearItems
virtual void clearItems()
nkWinUi::ListBox::getCurrentSelectionIndex
virtual int getCurrentSelectionIndex() const
nkWinUi::ListBox::Item::setParentList
void setParentList(ListBox *parent)
nkWinUi::listBoxSelectionCallback
std::function< bool(ListBox *caller)> listBoxSelectionCallback
Used by a nkWinUi::ListBox to signal a selection occurred inside.
Definition: CallbackRepository.h:103
nkWinUi::ListBox::Item::getAttachedData
void * getAttachedData() const
nkWinUi::ListBox::changeItemData
void changeItemData(const nkMemory::StringView &text, void *newData)
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Button.h:7
nkWinUi::ListBox::getItemFromData
Item * getItemFromData(void *data) const